package com.examination.controller.login;


import com.examination.bean.User;
import com.examination.controller.BaseServletController;
import com.examination.service.impl.RegisterService;
import com.examination.utils.ResponseResult;
import org.json.JSONObject;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name="/RegisterServlet",urlPatterns = "/RegisterServlet")
public class RegisterServlet extends BaseServletController {
    private RegisterService regUserService = new RegisterService();
    //注册用户
    public void registerUser(HttpServletRequest request, HttpServletResponse response){
        User user = new User();
        user = getObjectByRequest(user,request);
        regUserService.regUser(user);
        ResponseResult responseResult = new ResponseResult();
        responseResult.setState("200");
        JSONObject resResultJson = new JSONObject(responseResult);
        rendDate("application/json;charset=utf8", resResultJson.toString(), response);
    }
}